import request from '@/utils/request_zc'

export function getProductModelingList ({ keyword, page, limit }) {
  return request({
    url: '/mes/product/model/list',
    method: 'get',
    params: {
      keyword,
      page,
      limit
    }
  })
}

export function getProductModelingDetail ({ id }) {
  return request({
    url: `/mes/product/model/detail/${id}`,
    method: 'get',
  })
}

export function editProductModeling ({
  id,
  modelName,
  product,
  productModel,
  productSpecification,
  productUnit,
  remark,
  detailList
}) {
  return request({
    url: '/mes/product/model/edit',
    method: 'post',
    data: {
      id,
      modelName,
      product,
      productModel,
      productSpecification,
      productUnit,
      remark,
      detailList
    }
  })
}

export function addProductModeling ({
  modelName,
  product,
  productModel,
  productSpecification,
  productUnit,
  remark,
  detailList
}) {
  return request({
    url: '/mes/product/model/add',
    method: 'post',
    data: {
      modelName,
      product,
      productModel,
      productSpecification,
      productUnit,
      remark,
      detailList
    }
  })
}

export function getMaterialCategoryList () {
  return request({
    url: '/wms/material/category/list',
    method: 'get'
  })
}

export function getMaterialList ({ pid }) {
  return request({
    url: '/wms/material/list',
    method: 'get',
    params: {
      pid
    }
  })
}
